<?php
require_once("mailView.php");
require_once(CORE_DIR."userModel.php");
require_once(CORE_DIR."projectModel.php");

class reportAction extends authAction{

	function __construct(){
		$this->view = new mailView();
	}

	public function run($get, $post, $viewtype) {
		parent::run($get,$post,$viewtype);
		
		$uModel = new userModel();
		$activeUser = $uModel->getActiveUser();
		if($activeUser != null && $activeUser->getIsAdmin())
		{
			if (isset($get["pid"])){
				$projectId = $get["pid"];
				
				$pModel = new projectModel();
				
				$status = 0;
				if ($pModel->reportUpdates($projectId)){
					$status = 1;
				}
				$id = $projectId;
				
				$this->view->setProperty("status", $status);
				$this->view->setProperty("id", $id);
				$this->view->showReportTask();
			}			
		}
		else
		{
			$this->view->showBadCmd();
		}
	}
}
?>